<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <th:block th:include="fragments/header :: header"/>
</head>
<body>
<div class="easyui-layout" data-options="fit:true">
    <div data-options="region:'center',border:false">
        <form id="eventsForm" action="" method="post" style="padding-top: 10px;padding-left: 10px;">
            <table width="90%">
                <tr>
                    <td>名称：</td>
                    <td>
                        <input class="easyui-textbox" name="name" style="width: 60%" data-options="required:true"/>
                    </td>
                </tr>
            </table>
        </form>
    </div>
    <div data-options="region:'south',border:false">
        <div style="text-align: center">
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="submitForm()" style="width:80px">提交</a>
            <a href="javascript:void(0)" class="easyui-linkbutton" onclick="clearForm()" style="width:80px">取消</a>
        </div>
    </div>
</div>
<script>
    function submitForm() {
        $("#eventsForm").form('submit',{
            url:'/markt/events/save',
            onSubmit:function () {
                return $(this).form('enableValidation').form('validate');
            },
            success:function () {
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
            }
        });
    }

    function clearForm() {
        var index = parent.layer.getFrameIndex(window.name);
        parent.layer.close(index);
    }
</script>
</body>
</html>
